import React, {Component} from 'react';
import Table from '../Public/Table';


// createTime: "2019-06-13 22:47:49"
// currentUnitPrice: 300
// orderNo: 1560437269510
// productId: 268
// productImage: "fe6dc6dd-e892-4834-a9c0-1d60de8bbad0.jpg"
// productName: "Midea222/美的di BCD-535WKZM(E)冰箱双开门无霜智能家用厨卫家电"
// quantity: 1
// totalPrice: 300

class OrderDetailTable extends Component {
	constructor(props) {
		super(props);
		this.state = {
			columns: [
				{
					title: '商品图片',
					width: '15%',
					render: data => <img className="order-detail-img" src={this.props.imageHost + data.productImage}
					                     alt={data.productName}/>
				},
				{
					title: '商品信息',
					width: '40%',
					props: 'productName'
				},
				{
					title: '单价',
					width: '15%',
					render: data => '￥' + data.currentUnitPrice
				},
				{
					title: '数量',
					width: '15%',
					props: 'quantity'
				},
				{
					title: '合计',
					width: '15%',
					render: data => '￥' + data.totalPrice

				}
			]
		}
	}


	render() {
		return (
			<div>
				<Table columns={this.state.columns} data={this.props.data} keyProps="productId"/>
			</div>
		);
	}
}

export default OrderDetailTable;